Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear ENV["XDG_CONFIG_HOME"] to avoid loading user-defined irbrc in test #982

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Jul 17, 2024

TestIRB::ConfigValidationTest#setup forgot to clear ENV['XDG_CONFIG_HOME']

With these environment variables, rake test fails.

echo "puts 'IRBRC'; exit" > /path/to/dummy_home/env_irbrc
echo "puts 'HOME'; exit" > /path/to/dummy_home/.irbrc
echo "puts 'XDG'; exit" > /path/to/dummy_home/.config/irb/irbrc
IRBRC=/path/to/dummy_home/env_irbrc HOME=/path/to/dummy_home/ XDG_CONFIG_HOME=/path/to/dummy_home/.config rake test

Test passes with normal irbrc content maybe with Error loading RC file warning message, but it's better not to read user-defined irbrc file.

test/irb/helper.rb Outdated Show resolved Hide resolved
@tompng tompng merged commit 632da0f into ruby:master Jul 18, 2024
30 checks passed
@tompng tompng deleted the test_clear_xdg_env branch July 18, 2024 10:56
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants